import Vue from 'vue'
import VueRouter from 'vue-router'

const Home = () => import( /* webpackChunkName: "home_list" */ '../components/Home.vue')
const List = () => import( /* webpackChunkName: "home_list" */ '../components/List.vue')
const About = () => import( /* webpackChunkName: "welcome_about" */ '../components/About.vue')
const Welcome = () => import( /* webpackChunkName: "welcome_about" */ '../components/Welcome.vue')
const Setting = () => import( /* webpackChunkName: "Setting_Login" */ '../components/Setting.vue')
const Login = () => import( /* webpackChunkName: "Setting_Login" */ '../components/Set/Login.vue')
const Article = () => import( /* webpackChunkName: "Article" */ '../components/Article.vue')

const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
	return routerPush.call(this, location).catch(error => error)
}
Vue.use(VueRouter)

const routes = [{
		path: '/',
		redirect: '/home'
	},
	{
		path: '/home',
		component: Home,
		redirect: '/welcome',
		children: [{
			path: '/login',
			component: Login
		}, {
			path: '/welcome',
			component: Welcome
		}, {
			path: '/list',
			component: List
		}, {
			path: '/setting',
			component: Setting,
		}, {
			path: '/about',
			component: About
		}, {
			name:'article',
			path: '/article',
			component: Article
		}]
	}
]

const router = new VueRouter({
	routes
})

export default router
